package edu.wong.attendance_management_api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.wong.attendance_management_api.entity.Check;
import edu.wong.attendance_management_api.entity.dto.CheckDateDTO;
import edu.wong.attendance_management_api.entity.dto.QingjiaDTO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * 员工
 *
 */
public interface CheckMapper extends BaseMapper<Check> {

    @Select("SELECT  date_format( start_date, '%Y-%m-%d' ) by_date, count(*) count_num  FROM t_check GROUP BY date_format( start_date, '%Y-%m-%d' );")
    List<CheckDateDTO> selectLeaveNumByDate();

    @Select("select count(1)  from  t_check WHERE DATE(start_date) = CURDATE();")
    int listQingjiaDay();
    @Select("select count(1) from  t_check WHERE YEARWEEK(start_date) = YEARWEEK(NOW()) or YEARWEEK(end_date) = YEARWEEK(NOW()) ;")
    int listQingjiaWeek();
    @Select("select count(1) from  t_check WHERE YEAR(start_date) = YEAR(NOW()) and MONTH(start_date) = MONTH(NOW())  ;")
    int listQingjiaMonth();
}
